package com.yj.user.exception;

import java.util.HashMap;
import java.util.Map;

/**
 * 统一结果返回
 */
public class ResultResponse {

    private boolean isSuccess;
    private int code;
    private String message;
    private Map<Object,Object> data = new HashMap<>();

    private ResultResponse(){

    }

    public static ResultResponse success(){
        ResultResponse resultResponse = new ResultResponse();
        resultResponse.isSuccess = true;
        resultResponse.code = 2000;
        resultResponse.message = "success";
        return resultResponse;
    }

    public static ResultResponse fair(ResultCode code){
        ResultResponse resultResponse = new ResultResponse();
        resultResponse.isSuccess = false;
        resultResponse.code = code.getCode();
        resultResponse.message = code.getMessage();
        return resultResponse;
    }





}
